{include file="public/header" /}
<style>
    .pagelist {padding:10px 0; text-align:center;}
    .pagelist span,.pagelist a{ border-radius:3px; border:1px solid #dfdfdf;display:inline-block; padding:5px 12px;}
    .pagelist a{ margin:0 3px;}
    .pagelist span.current{ background:#09F; color:#FFF; border-color:#09F; margin:0 2px;}
    .pagelist a:hover{background:#09F; color:#FFF; border-color:#09F; }
    .pagelist label{ padding-left:15px; color:#999;}
    .pagelist label b{color:red; font-weight:normal; margin:0 3px;}
</style>
<body>
<div class="layui-tab layui-tab-brief main-tab-container">
    <ul class="layui-tab-title main-tab-title">
        <a href="{:url('notice/index')}"><li class="layui-this">公告列表</li></a>
        <a href="{:url('notice/add_notice')}"><li>添加公告</li></a>
        <div class="main-tab-item">公告管理</div>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <form class="layui-form" name="paixu" method="post" onsubmit="return false;">

                <table class="list-table">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>公告名称</th>
                        <th>创建时间</th>
                        <th>修改时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="gonggao" id="vo"}
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.title}</td>
                        <td>{$vo.create_tim|default=time()|date='Y-m-d H:i:s',###}</td>
                        <td>{$vo.update_tim|default=time()|date='Y-m-d  H:i:s',###}</td>
                        <td style="text-align: center;">
                            <a href="{:url('edit_notice',array('id'=>$vo['id']))}" class="layui-btn layui-btn-small" title="编辑"><i class="layui-icon"></i></a>
                            <a class="layui-btn layui-btn-small layui-btn-danger del_btn" category-id="1" title="删除" id="{$vo.id}"><i class="layui-icon"></i></a>
                        </td>
                    </tr>
                    {/volist}
                    </tbody>

                </table>

            </form>
            <p style="float: right;margin-right:20px;">{$gonggao->render()}</p>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        //删除操作
        $(".del_btn").click(function(){
            var $this = $(this)
            var id=$this.attr('id');
            $.ajax({
                url: "{:url('notice/edit_notice')}",
                data: {'id':id},
                type: "POST",
                datatype:"json",
                success: function( result ) {

                    $this.parents('tr').remove();
                    layer.open({
                        title: '信息'
                        ,content: '删除成功！'
                    });
                }
            });
        });
        //状态
        $("#zzz").click(function(){
            $.ajax({
                url: "{:url('article/status')}",
                data: $("form").serialize(),
                type: "POST",
                datatype:"json",
                success: function( result ) {
                    layer.open({
                        title: '信息'
                        ,content: '设置成功！'
                    });
                }
            });
        });

    });

    layui.use(['element', 'layer', 'form'], function(){
        var element = layui.element()
            ,jq = layui.jquery
            ,form = layui.form()
            ,laypage = layui.laypage;

    })
</script>
</body>
</html>